<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@page import="com.rbcs.base.company.CompanyHelp" %>
<%@ include file="/common/taglibs.jsp"%>
<html>
<head>
<title>在线报销及预算控制系统</title>
<%@include file="/common/meta.jsp"%>
<link href="${ctx}/pages/layout.css" type='text/css' rel='stylesheet'>
<%@include file="/common/extjs.jsp"%>
<script type="text/javascript" src="${ctx}/scripts/jquery/ui/jquery-ui-1.7.1.js"></script>
<script type="text/javascript" src="${ctx}/scripts/jquery/jgrowl/jquery.jgrowl_minimized.js"></script>
<script type="text/javascript" src="${ctx}/scripts/clock.js"></script>

<link rel="stylesheet" href="${ctx}/scripts/jquery/jgrowl/jquery.jgrowl.css" type="text/css"/>
<style type="text/css">
.userName{
	font-weight: bold;
	color: red;
}
.sysTitle{
	padding:5px 0px;
	font-family: serif;
	font-weight: bold;
	font-size: 20px;
}
</style>
</head>
<body>
<script type="text/javascript">
	Ext.onReady(function() {

		Ext.state.Manager.setProvider(new Ext.state.CookieProvider());

		var viewport = new Ext.Viewport( {
			layout : 'border',
			items : [ new Ext.BoxComponent( { // raw
						region : 'north',
						el : 'north',
						height : 45
					}), {
				region : 'west',
				id : 'west-panel',
				title : '&nbsp;',
				split : true,
				width : 150,
				minSize : 150,
				maxSize : 400,
				collapsible : true,
				margins : '0 0 5 5',
				layout : 'accordion',
				layoutConfig : {
					animate : false
				},
				items : [ 
				{
					title : '<span class="title">我的桌面</span>',
					html : document.getElementById('desktop').innerHTML,
					border : false,
					iconCls : 'desktop'
				},
				{
					title : '<span class="title">日常办公</span>',
					html : document.getElementById('office').innerHTML,
					border : false,
					iconCls : 'office'
				},
				{
					title : '<span class="title">借款管理</span>',
					html : document.getElementById('borrow').innerHTML,
					border : false,
					iconCls : 'borrow'
				},
				{
					title : '<span class="title">还款管理</span>',
					html : document.getElementById('return').innerHTML,
					border : false,
					iconCls : 'return'
				},				
				{
					title : '<span class="title">报销管理</span>',
					html : document.getElementById('reimb').innerHTML,
					border : false,
					iconCls : 'reimb'
				},
				{
					title : '<span class="title">预算管理</span>',
					html : document.getElementById('budget').innerHTML,
					border : false,
					iconCls : 'budget'
				},
				{
					title : '<span class="title">费用分摊</span>',
					html : document.getElementById('sharing').innerHTML,
					border : false,
					iconCls : 'budget'
				},
				{
					title : '<span class="title">基本信息</span>',
					html : document.getElementById('base').innerHTML,
					border : false,
					iconCls : 'base'
				},
				{
					title : '<span class="title">系统管理</span>',
					html : document.getElementById('system').innerHTML,
					border : false,
					iconCls : 'system'
				}]
			},
			{
				region : 'center',
				contentEl : 'center',
				split : true,
				border : true,
				margins : '0 5 5 0'
			} ]
		});
	});

</script>
<%@include file="/pages/menu.jsp"%>
<div id="west"></div>
<div id="north" align="center" style="margin:0px;">
   <table width="100%" height="45" cellpadding="0" cellspacing="0">
    <tr>
      <td align="left" width="60%" rowspan="2">
        &nbsp;&nbsp;
        <span class="sysTitle" style="color:#CA0400; font-family:sans-serif;">RBCS</span>
        <span class="sysTitle">在线报销及预算管理系统</span>
        <%
        	if (CompanyHelp.COMPAY.getName() != null){
        %>●
        <span class="sysTitle"><%=CompanyHelp.COMPAY.getName()%></span>
        <% } %>
      </td>
	  <td width="40%" align="right" style="color:#336699; padding-right:20px">
        <stc:ifLogin>
          &nbsp;欢迎您：<span class="userName"><stc:username></stc:username></span>&nbsp;&nbsp;&nbsp;
		</stc:ifLogin>
		<img src="${ctx}/images/icons/time.gif">
		<span id="timeView"></span>&nbsp;&nbsp; 
	  </td>
    </tr>
	<tr>
	  <stc:ifLogin>
		<td colspan="3" width="60%" align="right" style="color: #336699; padding-right: 20px">
			<a href="${ctx}/main/index.do" target="main" style="color: #336699">
				<img src="${ctx}/images/icons/house.gif">&nbsp;首页
			</a>
			&nbsp;&nbsp;|&nbsp;&nbsp; 
			<a href="${ctx}/pages/admin/security/user/user.jsp" target="main" style="color: #336699">
				<img src="${ctx}/images/icons/user.gif">&nbsp;个人信息
			</a>
			&nbsp;&nbsp;|&nbsp;&nbsp; 
			<a href="${ctx}/j_acegi_logout" target="_self" style="color: #336699">
				<img src="${ctx}/images/icons/lock_go.gif">&nbsp;注销 
			</a>
			${param.bbsId}
		</td>
	  </stc:ifLogin>
	  <stc:ifNotLogin>
		<td width="40%" align="right" style="color: #336699; padding-right: 20px">
			<a href="${ctx}/login.jsp" target="_self" style="color: #336699">
				<img src="${ctx}/images/icons/user_go.gif">&nbsp;登录 
			</a>
			<a href="${ctx}/restorePassword/edit.do" target="_self" style="color: #336699">
				<img src="${ctx}/images/icons/zoom.gif">&nbsp;忘记密码
			</a>
		 </td>
	  </stc:ifNotLogin>
	</tr>
  </table>
</div>
<div id="center">
	<iframe id="main" name="main" style="width:100%; height:100%; border: 0px;" frameborder="0">
	</iframe>
</div>
<script type="text/javascript">
$.jGrowl.defaults.position = "bottom-right";
$.jGrowl.defaults.life = 13000;
$.jGrowl.defaults.pool = 5;
function checkNewMsg(){
	$.ajax({
	    url: '${ctx}/msg/checkNewMsgs.do',
	    type: 'post',
	    dataType: 'json',
	    error: function(){
	    	//alert('check new msg error');
	    },
	    success: function(data, textStatus){
	    	if (data == null || data.length == 0){
				return;	    		
	    	}
	    	var htmlStr = null;
	    	var num = 0;
	    	for(i = 0; i < data.length; i++){
	    		num = i + 1;
	    		htmlStr = "";
	    		htmlStr += "<div style='width:200px; height:20px; padding:0px;'>";
	    		htmlStr += "<a href='${ctx}/msg/view.do?model.id=" + data[i][0] + "&updateState=Y' target='main'><b>"+ num + "</b>." + data[i][1] + "</a>";
	    		htmlStr += "</div>";
				$.jGrowl(htmlStr);
	    	}
	    }
	});
}
window.setInterval("checkNewMsg()",30000);
checkNewMsg();

var clock = new Clock();
clock.display(document.getElementById("timeView"));
</script>
</body>
</html>
